<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
    	<meta charset="UTF-8">
	<title><?php echo ('[title]' == '['.'title'.']' ? C('WEBSITE_NAME') : '[title]');?></title>
	<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="red" name="apple-mobile-web-app-status-bar-style">
	<meta name="format-detection" content="telphone=no">
	<link rel="stylesheet" href="/css/mall.css?modify=20161026">
	<link rel="stylesheet" href="/css/trade.css?modify=20161026">
	<link rel="stylesheet" href="/css/red.css">
	<script type="text/javascript">
	var require = {
		baseUrl: '/js',
		waitSeconds: 0,
		map: {
		  '*': {
			'css': '//cdn.bootcss.com/require-css/0.1.8/css.min.js',
			'text': '//cdn.bootcss.com/require-text/2.0.12/text.min.js'
		  }
		},
		shim: {
			swiper: ['jquery', 'css!//cdn.bootcss.com/Swiper/3.3.1/css/swiper.min.css'],
			lazyload: ['jquery'],
		},
		paths: {
            'jquery': '//cdn.bootcss.com/jquery/1.12.4/jquery.min',
			'template': 'template',
			'validatejs': '//cdn.bootcss.com/jquery-validate/1.15.0/jquery.validate.min',
			'weixinjs': 'https://res.wx.qq.com/open/js/jweixin-1.0.0',
			'lazyload': '//cdn.bootcss.com/jquery.lazyload/1.9.1/jquery.lazyload.min',
			'swiper': '//cdn.bootcss.com/Swiper/3.3.1/js/swiper.min',

			'mall/cart': 'h5.js?modify=20161026',
			'view/order/list': 'h5.js?modify=20161026',
			'view/balance': 'h5.js?modify=20161026',
			'module/cart/num': 'h5.js?modify=20161026',
			'order/address': 'h5.js?modify=20161026',
			'pay': 'h5.js?modify=20161026',
			'view/personal/edit': 'h5.js?modify=20161026',
			'view/personal/scoreDetail': 'h5.js?modify=20161026',
			'view/present/list': 'h5.js?modify=20161026',
			'view/score': 'h5.js?modify=20161026',
			'pay/express': 'h5.js?modify=20161026',
			'jsweixin': 'h5.js?modify=20161026',
			'skumodal': 'h5.js?modify=20161026',
			'customer_service': 'h5.js?modify=20161026',
			'order/refund': 'h5.js?modify=20161026',
			'model_pay_coupon': 'h5.js?modify=20161026',
			'login_modal': 'h5.js?modify=20161026',
			'member/collection': 'h5.js?modify=20161026',
            'pullfresh': 'h5.js?modify=20161026',
            'goods_list': 'h5.js?modify=20161026',
          	'search': 'h5.js?modify=20161026',
		}
	}
	</script>
	<?php if(IS_APP): ?><script type="text/javascript" src="/js/appcan.min.js"></script><?php endif; ?>
	<script data-main="/js/h5.js?modify=20161026" src="//cdn.bootcss.com/require.js/2.3.1/require.min.js"></script>
	<?php if(!APP_DEBUG){ require_once 'cs.php';echo '<img src="'._cnzzTrackPageView(1259294058).'" width="0" height="0" style="display:none;"/>'; } ?>
    <link rel="stylesheet" href="/css/usercenter.css?modify=20160921" type="text/css" />
</head>
<body class="body-fixed-bottom">
    <div class="container">
        <div class="content ">
            <div class="content-body">
                <div class="personal-header">
                    <div class="advertisement">
                        <?php if(is_array($advs)): foreach($advs as $key=>$item): ?><a href="<?php echo ($item["url"]); ?>" class="ellipsis" target="_blank"><?php echo ($item["title"]); ?></a><?php endforeach; endif; ?>
                    </div>
                    <div class="headimg js-headimgurl">
                        <div style="background-image: url(<?php echo ($user["headimgurl"]); ?>);" class="headimg-url"></div>
	                </div>
	                <div style="display: block;text-align: center;color: #fff;margin: 10px 0;"><?php echo ($user["nickname"]); ?>(<?php echo ($user["agent_title"]); ?>)</div>
	                <div class="balance-info">
                        <a href="/h5/balance" class="balance-value">积分余额：¥<?php echo ($user["total_balance"]); ?></a>
                        <a href="javascript:;" class="js-sign everyday-sign pull-right">领积分</a>          
	                </div>
                </div>
                <div class="order-info clearfix">
			        <a href="/h5/order" class="order-item">
			            <i class="icon-links icon1_1"></i>
			            <span class="title">全部订单</span>
			            <span class="num"><?php echo ($order["total"]); ?></span>
			        </a>
			        <a href="/h5/order?status=topay" class="order-item">
			            <i class="icon-links icon1_2"></i>
			            <span class="title">待付款</span>
			            <span class="num"><?php echo ($order["topay"]); ?></span>
			        </a>
			        <a href="/h5/order?status=tosend" class="order-item">
			            <i class="icon-links icon1_3"></i>
			            <span class="title">待发货</span>
			            <span class="num"><?php echo ($order["tosend"]); ?></span>
			        </a>
			        <a href="/h5/order/?status=refund" class="order-item">
			            <i class="icon-links icon1_4"></i>
			            <span class="title">退换货</span>
			            <span class="num"><?php echo ($order["torefund"]); ?></span>
			        </a>
			    </div>

                <div class="order-related">
                    <div class="block block-list list-vertical">
                        <a class="block-item link ico-record" href="/h5/cart">
                            <p class="title-info c-black">我的购物车</p>
                        </a>
                        <a class="block-item link ico-backs" href="/h5/balance">
                            <p class="title-info c-black">积分提现</p>
                        </a>
                    </div>
                    <div class="block block-list list-vertical">
                        <a class="block-item link ico-friend" href="/h5/personal/friends">
                            <p class="title-info c-black">我的好友</p>
                        </a>
                        <a class="block-item link ico-member" href="/h5/pay/rule">
                            <p class="title-info c-black">成为会员</p>
                        </a>
                    </div>
                    <div class="block block-list list-vertical">
                        <a class="block-item link ico-coupon" href="/h5/coupon">
                            <p class="title-info c-black">优惠卡券</p>
                        </a>
                        <a class="block-item link ico-collection" href="/h5/collection">
                            <p class="title-info c-black">我的收藏</p>
                        </a>
                        <!-- 
                        <a class="block-item link ico-gift" href="javascript:toast.show('正在开发中');">
                            <p class="title-info c-black">我的赠品</p>
                        </a>
                         -->
                    </div>
                    <div class="block block-list">
                        <a class="block-item link center" href="javascript:win.close()">
                            <p class="title-info c-black">退出系统</p>
                        </a>
                    </div>
                </div>
            </div>
        </div>
   		<div class="js-footer footer">
	<div class="copyright">
		<div class="ft-links">
			<a href="/h5/mall" target="_blank">商城主页</a>
			<a href="/h5/list" target="_blank">全部商品</a>
			<a href="/h5/personal" target="_blank">会员中心</a>
			<a href="/h5/cart" target="_blank">购物车</a>
		</div>
		<a class="ft-copyright" target="_blank">
			<span class="company hide">兴业宝提供技术支持</span>
		</a>
	</div>
</div>
        <div id="shop-nav">
	<div class="shop-nav nav-menu nav-menu-1 has-menu-3">
		<div class="nav-special-item nav-item">
			<a href="/h5/mall" class="home jump_link">主页</a>
		</div>
		<div class="nav-item">
			<a class="mainmenu" href="http://mp.weixin.qq.com/s?__biz=MzI0NTQ3NzM2Ng==&mid=100004787&idx=1&sn=cf78c5f8fc9bd47bbafa73295f68d5bb&chksm=694ca92a5e3b203c67ac6ff97bb4c607e71f1994f4053ebbe6890d80e3b348d7c44cf312bcc9#rd">
				<span class="mainmenu-txt">在线客服</span>
			</a>
		</div>
	 	<div class="nav-item">
			<a href="/h5/list" class="mainmenu">
	 			<span class="mainmenu-txt">全部商品</span>
	 		</a>
		</div>
	 	<div class="nav-item">
	 		<a href="/h5/personal" class="mainmenu">
	 			<span class="mainmenu-txt">会员中心</span>
	 		</a>
	 	</div>
	</div>
    <link rel="stylesheet" href="/css/shopnav.css?modify=20160921" type="text/css" />
</div>
    </div>
</body>
    <script>
    require(['jquery'], function(){
        var user = <?php echo json_encode($user);?>;
        $('.js-headimgurl').on('click', function(){
            require(['view/personal/edit'], function(view){
                view.show(user, function(data){
                    $.ajax({
                        url: '/h5/personal/save',
                        data: {data:data},
                        type: 'post',
                        datatype: 'text',
                        success: function(){
                            user = $.extend(user, data);
                        }
                    });
                })
            });
            return false;
        });
        
        // 领积分
        $('.js-sign').on('click', function(){
        	var $this = $(this);
        	$.ajax({
        		url: '/h5/personal/sign',
        		type: 'post',
        		dataType: 'json',
        		success: function(data){
        			toast.show('连续签到'+data.continued+'次');
        			$this.siblings('.balance-value').html('积分余额：¥' + (data.balance*1 + data.no_balance*1).toFixed(2));
        		}
        	});
        	return false;
        });
    });
    </script>
</html>